﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for LoaiBOL
/// </summary>
public class LoaiBOL
{
    
    public LoaiBOL()
    {
        //
        // TODO: Add constructor logic here
        //
    }
    public static List<LoaiEntity> getAllLoaiByStatus(int statu)
    {
        DBHelp help = new DBHelp();
        List<LoaiEntity> list = new List<LoaiEntity>();        
        List<SqlParameter> listParam = new List<SqlParameter>();
        SqlDataReader reader;
        SqlParameter param;
        param = new SqlParameter("@statu", SqlDbType.Int);
        param.Value = statu;
        listParam.Add(param);
        reader = help.ExcuteQuery_GetDataReader("getAllLoaiByStatus", listParam);
        if (reader.HasRows)
        {
            while (reader.Read())
            {
                LoaiEntity loai = new LoaiEntity();
                loai.LoaiID = Convert.ToInt32(reader["LoaiID"].ToString());
                loai.TenloaiNO = reader["TenloaiNO"].ToString();
                loai.Tenloai = reader["Tenloai"].ToString();
                loai.Chitietloai = reader["Chitietloai"].ToString();
                loai.Statu =Convert.ToBoolean(reader["Statu"].ToString());
                list.Add(loai);
            }
        }
        return list;
    }
}